import { instance } from "../utils/request";
const getDictionarysPagination = async (params) => {
  return await instance.get("/Dictionarys/Pagination", params);
};

const addDictionarys = async (data) => {
  return await instance.post("/Dictionarys/Add", data);
};

const updateDictionarys = async (data) => {
  return await instance.post("/Dictionarys/Update", data);
};

const getDictionarysDetail = async (id) => {
  return await instance.get("/Dictionarys/Detail", { id: id });
};

const deleteDictionarys = async (id) => {
  return await instance.post("/Dictionarys/Delete", { id: id });
};

const getSunDictionaryByDTId = async (id) => {
  return await instance.get("/Dictionarys/GetSunDictionaryByDTId", { id: id });
};

const getSunDictionaryByParentId = async (id) => {
  return await instance.get("/Dictionarys/GetSunDictionaryByParentId", {
    id: id,
  });
};

const getDictionaryBySearchKey = async (searchKey) => {
  return await instance.get("/Dictionarys/GetDictionaryBySearchKey", {
    searchKey: searchKey,
  });
};

const dictionarysApi = {
  getDictionarysPagination,
  addDictionarys,
  updateDictionarys,
  getDictionarysDetail,
  deleteDictionarys,
  getSunDictionaryByDTId,
  getSunDictionaryByParentId,
  getDictionaryBySearchKey,
};

export default dictionarysApi;
